package com.huaju.enity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * Profit entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "profit", catalog = "licai")
public class Profit implements java.io.Serializable {

	// Fields

	private Integer pid;
	private Integer comId;
	private Paytype paytype;
	private Account account;
	private Date itime;
	private String idesc;
	private String payCode;
	private Double imoney;
	private Short success;
	private Date successTime;
	private String openId;
	private Integer toType;
	private String moneyStr;
	private String extr;

	// Constructors

	/** default constructor */
	public Profit() {
	}

	/** full constructor */
	public Profit(Paytype paytype, Account account, Date itime,
			String idesc, Double imoney, Short success, Date successTime) {
		this.paytype = paytype;
		this.account = account;
		this.itime = itime;
		this.idesc = idesc;
		this.imoney = imoney;
		this.success = success;
		this.successTime = successTime;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "pid", unique = true, nullable = false)
	public Integer getPid() {
		return this.pid;
	}

	public void setPid(Integer pid) {
		this.pid = pid;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "ptype")
	public Paytype getPaytype() {
		return this.paytype;
	}

	public void setPaytype(Paytype paytype) {
		this.paytype = paytype;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "aid")
	public Account getAccount() {
		return this.account;
	}

	public void setAccount(Account account) {
		this.account = account;
	}

	@Column(name = "itime", length = 19)
    @DateTimeFormat(pattern="yyyy-MM-dd" ) 
    @JsonFormat(pattern="yyyy-MM-dd" ,timezone = "GMT+8")
	public Date getItime() {
		return this.itime;
	}

	public void setItime(Date itime) {
		this.itime = itime;
	}

	@Column(name = "idesc")
	public String getIdesc() {
		return this.idesc;
	}

	public void setIdesc(String idesc) {
		this.idesc = idesc;
	}

	@Column(name = "imoney", precision = 10)
	public Double getImoney() {
		return this.imoney;
	}

	public void setImoney(Double imoney) {
		this.imoney = imoney;
	}

	@Column(name = "success")
	public Short getSuccess() {
		return this.success;
	}

	public void setSuccess(Short success) {
		this.success = success;
	}

	@Column(name = "successTime", length = 19)
    @DateTimeFormat(pattern="yyyy-MM-dd" ) 
    @JsonFormat(pattern="yyyy-MM-dd" ,timezone = "GMT+8")
	public Date getSuccessTime() {
		return this.successTime;
	}

	public void setSuccessTime(Date successTime) {
		this.successTime = successTime;
	}

	public Integer getComId() {
		return comId;
	}

	public void setComId(Integer comId) {
		this.comId = comId;
	}

	public String getPayCode() {
		return payCode;
	}

	public void setPayCode(String payCode) {
		this.payCode = payCode;
	}

	public String getOpenId() {
		return openId;
	}

	public void setOpenId(String openId) {
		this.openId = openId;
	}

	public Integer getToType() {
		return toType;
	}

	public void setToType(Integer toType) {
		this.toType = toType;
	}


	public String getMoneyStr() {
		return moneyStr;
	}

	public void setMoneyStr(String moneyStr) {
		this.moneyStr = moneyStr;
	}

	public String getExtr() {
		return extr;
	}

	public void setExtr(String extr) {
		this.extr = extr;
	}

}